package com.mowh.gof23.creational.patterns.prototype;

import com.mowh.gof23.creational.patterns.prototype.framework.Product;

/**
 * @author mowh1gd
 * @create 2023/10/20 15:37
 */
public class UnderlinePen implements Product {
    private char ulChar;

    public UnderlinePen(char ulChar) {
        this.ulChar = ulChar;
    }

    @Override
    public void use(String aString) {
        int length = aString.getBytes().length;
        System.out.println("\"" + aString + "\"");
        System.out.print(" ");
        for (int i = 0; i< length; i++) {
            System.out.print(ulChar);
        }
        System.out.println("");
    }

    @Override
    public Product createClone() throws CloneNotSupportedException {
        Product p = null;
        p = (Product) clone();
        return p;
    }
}
